<?php
include "api/LbsApiBasic.class.php";
include "api/LbsService.class.php";
include "api/LbsTrack.class.php";
include "api/LbsConf.class.php";
include "api/LbsRelation.class.php";
include "api/LbsAttribute.class.php";
echo "<pre>";
/**
 * service 接口测试
 */
$service_id = 101408;
//$service = new LbsService(101408);
////$data = $service->create('serviceTest02','test service 1',2);
//
//$service->setServiceId($service_id);
//$service->detail($service_id);
//$response = $service->getResponse();
//print_r($response);

//$service->serviceList();
//$response = $service->getResponse();
//print_r($response);
//
//$service->update($service_id,'serviceTest03','test update');
//$response = $service->getResponse();
//print_r($response);
//
//$service->detail($service_id);
//$response = $service->getResponse();
//print_r($response);

//$service->delete($service_id);
//$response = $service->getResponse();

//$column = array();
//$column['column_name'] = '宝贝编号';
//$column['column_key'] = 'kit_id';
//$column['column_type'] = 1;
//$column['max_length'] = 48;
//$column['default_value'] = 0;
//$service->addcolumn($column);

//$service->delColumn(165125);
//$response = $service->getResponse();
//print_r($response);
//
//$column = array();
//$column['column_id'] = 165124;
//$column['column_name'] = '宝贝编号';
//$column['column_key'] = 'kit_id';
//$column['column_type'] = 1;
//$column['max_length'] = 48;
//$column['default_value'] = 0;
//$service->updatecolumn($column);
//$response = $service->getResponse();
//print_r($response);
//
//$detail = $service->detail($service_id);
//print_r($detail);
//$response = $service->getResponse();
$track = new LbsTrack($service_id);
//$data = array();
//$data['latitude'] = 45.121;
//$data['longitude'] = 33.411;
//$data['coord_type'] = 1;
//$data['loc_time'] = time();
//$data['track_name'] = $service_id."_track03";
//$data['direction'] = 1;
//$data['speed'] = 2;
//$data['user_info'] = 1;
//$data['power'] = 93;
//$data['dispatch_state'] = '完成';
//$data['radius'] = 50;
//$data['chipno'] = 1;
//$track_id = $track->create($data);
//$response = $track->getResponse();
//print_r($response);


//$t1 = $track->detail(array('track_id'=>1304714209));
//$t2 = $track->detail(array('track_id'=>1304717183));
//$t3 = $track->detail(array('track_id'=>1304721526));
//print_r($t1);
//print_r($t2);
//print_r($t3);

//$data = $track->trackList(array('Track_ids'=>'1304714209,1304717183,1304721526','return_type'=>0));
//print_r($data);

$data = $track->trackList(array('track_name'=>'track_','return_type'=>1),1,1000);
print_r($data);

//$trackfile = "poi.csv";
//$track->upload('101408_track02',$trackfile);
//$response = $track->getResponse();
//print_r($response);
//$res = $track->history(array('track_name'=>'101408_track03','start_time'=>1440801000,'end_time'=>1440829648));
//$response = $track->getResponse();
//print_r($response);

//$track->delete(array('track_id'=>1304717183));
//$response = $track->getResponse();
//print_r($response);

//$track_id = 1304714209;
//$track_name = '101408_track02';
//$conf = new LbsConf($service_id);
//$data = array('lockswitch'=>'on','searchpage'=>10);
//$conf->setConf(array('track_id'=>$track_id),$data);
//$response = $conf->getResponse();
//print_r($response);

//$data = $conf->getConf(array('track_id'=>$track_id));
//print_r($data);
//$response = $conf->getResponse();
//print_r($response);

//$relation = new LbsRelation($service_id);
//$relation->create('chip_02',$track_name,'chip02 service02 relation');
//$response = $relation->getResponse();
//print_r($response);

//$res = $relation->detail('chip_02');
//print_r($res);

//$relation->delete('chip_02',$track_name);
//$response = $relation->getResponse();
//print_r($response);

//$attr = new LbsAttribute($service_id);
////$attr->add('attr_1','attr one');
////$attr->add('attr_2','attr two',1);
////$attr->add('attr_3','attr three',1);
////
////$attr->delete('attr_1');
//$response = $attr->getResponse();
//print_r($response);
//
//$attr->update('attr_2','attr two changed',0);
//$response = $attr->getResponse();
//print_r($response);

//$attr->set($track_name,'attr_3,11111');
//$response = $attr->getResponse();
//print_r($response);
//$attr->batchset("attr.csv");
//$response = $attr->getResponse();
//print_r($response);
?>